package com.cy.pj.notice.web;

import com.cy.pj.notice.web.interceptor.TimeAccessInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.LinkedList;
import java.util.List;

//配置类
@Configuration
public class SpringWebConfig implements WebMvcConfigurer {
    private static final Logger log = LoggerFactory.getLogger(SpringWebConfig.class);

    @Override
    //注册拦截器
    public void addInterceptors(InterceptorRegistry registry) {
        TimeAccessInterceptor interceptor = new TimeAccessInterceptor();
        registry.addInterceptor(interceptor).addPathPatterns("/notice/*");
        log.info("拦截器注册完成{}", interceptor);
    }
}
